import os
from pathlib import Path
file=open("config.txt","r")
txt=file.read()
#读取配置
game_path=txt.split(",")[0].split("-")[1]
engine_path=txt.split(",")[1].split("-")[1]
print(game_path)
print(engine_path)
#目录获取
list=os.listdir(game_path)
game_dirs=[]
print(list)
index=0
#过滤压缩文件
for i in list:
    if "zip" in i or "rar" in i or "7z" in i:
        del list[index]
    index+=1
print("处理后"+str(list))
#处理字符串用于给love读取
swap_txt=""
for i in list:
    swap_txt+=i+","
#对应的路径 本来想用JSON的 但是json的库不会用
swap=open("swapBridge.txt","w",-1,"utf-8")
swap.write(swap_txt)
swap.close()
file.close()